home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / bbs / dlmst251.zip / DOSWDW.DOC < prev    next >
Text File  |  1989-12-29  |  3KB  |  76 lines

  1. --------------------------------------------------------------------------
  2. DOSWDW: A windowed execution of a child process in Turbo C.
  3. --------------------------------------------------------------------------
  4.  
  5. Author: Edward V. Dong                             Date: 29 December 1989
  6.  
  7. DOSWDW is based on EXECWINDOW by Kim Kokkonen, TurboPower Software,
  8. which was released to the public domain, and which I ported to Turbo C.
  9.  
  10. What it does is to use a routine doswdw() to keep the video output of a
  11. child process within a specified window on the screen.  The technique
  12. used is to grab interrupt 21h and thus control all writes to the
  13. standard output and error devices.  These are rerouted to the screen,
  14. within the specified window.  Note that the technique will not work for
  15. programs that write directly to video memory, through the BIOS, or
  16. through some other file handle assigned to the console.  It does work
  17. with standard DOS commands, with the TPC.EXE compiler, and with other
  18. command line utilities like ARCX.COM.
  19.  
  20. Files included are: doswdw.asm (assembly code), doswdw.obj (large
  21. model), and test files (test2.c, test2.prj, test2.exe).  The source
  22. code (doswdw.asm and test2.c) is extensively annotated, and provides a
  23. good explanation of how the code works.
  24.  
  25. Note that the standard definition of getvect and setvect are altered, as
  26. follows:
  27.  
  28. void    interrupt    (* _Cdecl getvect(int interruptno)) ();
  29. void     _Cdecl setvect (int interruptno,void far *isr);
  30.  
  31. Prototypes:
  32. ----------
  33. void    interrupt doswdw(void);        /* DOS window routine */
  34. void    far setup21(int NumberOfRows);    /* doswdw() setup routine */
  35.  
  36.     NOTE: The parameter NumberOfRows should be either ZERO (0) or the
  37.     exact number of rows in the window that you use.
  38.  
  39. Required Global Variables:
  40. -------------------------
  41. void     far *newint21 = &doswdw;    /* points to doswdw() */
  42. int    wdwpos,        /* cursor position in window */
  43.     wdwupr,        /* top right corner */
  44.     wdwlwr;        /* bottom left corner */
  45. char    wdwattr;    /* desired attribute */
  46.  
  47.     NOTE: Parameters 'wdwpos', 'wdwupr', and 'wdwlwr' are actually
  48.     packed short unsigned integers, each comprising bytes for the x-
  49.     and y-coordinates.  See code below for order of bytes.  The x- and
  50.     y-coordinates are DECREMENTED by one to conform with the standard
  51.     BIOS screen conventions which start from (0,0), instead of Turbo
  52.     C's convention of starting at (1,1).
  53.  
  54. Recommended (but not required) Global Variable:
  55. ----------------------------------------------
  56. void     far *oldint21 = NULL;        /* to save the old int 21h vector */
  57.  
  58. FINALLY: Here's the prototype for DosWdw (please note the changed
  59. capitalization!), where pausing is embedded.  It creates a window using
  60. the standard Turbo C calls, and runs the command ('cmd') via a system()
  61. call.
  62.  
  63. void far DosWdw(int xleft,int ytop,int xrite,int ybottom,int attrib,char *cmd)
  64.  
  65.      xleft,ytop,xrite,ybottom are the coordinates of the WINDOW you want,
  66.      in standard Turbo C screen coordinate convention.
  67.  
  68.      'attrib' is the text attribute to be used.
  69.  
  70.      'cmd' is the command to initiate the child process, in the test
  71.      case used, via the system() command.
  72.  
  73. Basically, you now have a complete package to be integrated into your
  74. programs, and which is easily alterable.  If you do, I'd appreciate a
  75. copy of these program(s) in source; money is also very nice, too! and a
  76. credit line somewhere for yours truly.